import { Body, Controller, Get, Post, Req, Res } from '@nestjs/common';
import { ChatService } from './chat.service';
import { Request, Response } from 'express';
import { _fileStructure, createDirectoryFromStructure, readDirectory } from 'src/common/dir';
import { chatgptTest } from './core/chatgpt';
// import { chatgptTest } from './core/chatgpt';

@Controller('hunyuan')
export class ChatController {
  constructor(private readonly appService: ChatService) { }

  @Post('chat')
  chatProcess(@Body("question") question: string, @Res() res: Response) {
    this.appService.chatProcess(question, res);
  }
  @Get('read_dir')
  readDir() {
    const res = readDirectory('E:/Project/工作空间/vivo/0000265-NiMenBuYaoZaiDaLe/Code/server/src/example/new-project');
    console.log(res);
    return JSON.stringify(res);
  }


  // @Get('gen_dir')
  // generateDir() {
  //   createDirectoryFromStructure(_fileStructure, 'E:/Project/工作空间/vivo/0000265-NiMenBuYaoZaiDaLe/Output/server/src/example');
  //   return 'ok'
  // }

  // @Get('chatgpt')
  // chatgpt() {
  //   chatgptTest()
  // }
}
